<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8" />
    <title>what is data delegate?</title>
</head>

<body>
    <!-- 通过一个对象对另一个对象操作数据 读写-->

    <script type="text/javascript">
        let obj = { x: 100 }
        let obj2 = { x: 200 }
        Object.defineProperty(obj2, 'x', {
            get: function () {
                return obj.x
            },
            set(value) {
                obj.x = value
            }
        })
    </script>
</body>

</html>